<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>fastText: /data/users/cpuhrsch/fbsource/fbcode/deeplearning/fastText/src/model.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="favicon.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">fastText
   &#160;<span id="projectnumber">d00d36476b15</span>
   </div>
   <div id="projectbrief">Fast text processing tool/library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('model_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">model.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="model_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#ifndef FASTTEXT_MODEL_H</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#define FASTTEXT_MODEL_H</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;random&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;utility&gt;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="args_8h.html">args.h</a>&quot;</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="matrix_8h.html">matrix.h</a>&quot;</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="vector_8h.html">vector.h</a>&quot;</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="qmatrix_8h.html">qmatrix.h</a>&quot;</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="real_8h.html">real.h</a>&quot;</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="model_8h.html#a2e8aaf1ce5284c2017df4d6a3b631532">   24</a></span>&#160;<span class="preprocessor">#define SIGMOID_TABLE_SIZE 512</span></div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="model_8h.html#a526b042c8c04cdd0f0f5c9e097d5ca34">   25</a></span>&#160;<span class="preprocessor">#define MAX_SIGMOID 8</span></div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="model_8h.html#a39f445c336c3e871eccbaa0423b6daef">   26</a></span>&#160;<span class="preprocessor">#define LOG_TABLE_SIZE 512</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacefasttext.html">fasttext</a> {</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="structfasttext_1_1Node.html">   30</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structfasttext_1_1Node.html">Node</a> {</div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="structfasttext_1_1Node.html#a57d838e16a5dbb34aa0548a20843cf09">   31</a></span>&#160;  int32_t <a class="code" href="structfasttext_1_1Node.html#a57d838e16a5dbb34aa0548a20843cf09">parent</a>;</div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="structfasttext_1_1Node.html#a44f47a277a7fc982be30569befc7d8c1">   32</a></span>&#160;  int32_t <a class="code" href="structfasttext_1_1Node.html#a44f47a277a7fc982be30569befc7d8c1">left</a>;</div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="structfasttext_1_1Node.html#a8a02d78386d6837a20858269bf9c6366">   33</a></span>&#160;  int32_t <a class="code" href="structfasttext_1_1Node.html#a8a02d78386d6837a20858269bf9c6366">right</a>;</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="structfasttext_1_1Node.html#a76430b0ffbb3b8f217435b11e4f51118">   34</a></span>&#160;  int64_t <a class="code" href="structfasttext_1_1Node.html#a76430b0ffbb3b8f217435b11e4f51118">count</a>;</div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="structfasttext_1_1Node.html#a567bed8e85aa54f73371420f1b42dcda">   35</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="structfasttext_1_1Node.html#a567bed8e85aa54f73371420f1b42dcda">binary</a>;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;};</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html">   38</a></span>&#160;<span class="keyword">class </span><a class="code" href="classfasttext_1_1Model.html">Model</a> {</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;  <span class="keyword">private</span>:</div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#ae7c72e4f6b9fda134708d08efb0170e2">   40</a></span>&#160;    std::shared_ptr&lt;Matrix&gt; <a class="code" href="classfasttext_1_1Model.html#ae7c72e4f6b9fda134708d08efb0170e2">wi_</a>;</div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#ad6b3771605106e55bb132be316ec34b9">   41</a></span>&#160;    std::shared_ptr&lt;Matrix&gt; <a class="code" href="classfasttext_1_1Model.html#ad6b3771605106e55bb132be316ec34b9">wo_</a>;</div><div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#ac9524ea5200abefdd2d83e29ffaa9693">   42</a></span>&#160;    std::shared_ptr&lt;QMatrix&gt; <a class="code" href="classfasttext_1_1Model.html#ac9524ea5200abefdd2d83e29ffaa9693">qwi_</a>;</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a4ee087454e830b18c22a59ae9bb6fcf1">   43</a></span>&#160;    std::shared_ptr&lt;QMatrix&gt; <a class="code" href="classfasttext_1_1Model.html#a4ee087454e830b18c22a59ae9bb6fcf1">qwo_</a>;</div><div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a76314e94e2582e9e2160bcfd9c75ba99">   44</a></span>&#160;    std::shared_ptr&lt;Args&gt; <a class="code" href="classfasttext_1_1Model.html#a76314e94e2582e9e2160bcfd9c75ba99">args_</a>;</div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a31e9eee86f238bd2962569be67444e79">   45</a></span>&#160;    <a class="code" href="classfasttext_1_1Vector.html">Vector</a> <a class="code" href="classfasttext_1_1Model.html#a31e9eee86f238bd2962569be67444e79">hidden_</a>;</div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a845160e4cdb0e8c17b74f269563dc71c">   46</a></span>&#160;    <a class="code" href="classfasttext_1_1Vector.html">Vector</a> <a class="code" href="classfasttext_1_1Model.html#a845160e4cdb0e8c17b74f269563dc71c">output_</a>;</div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a79bd4bcbd2e6f10c5483249dfea74e97">   47</a></span>&#160;    <a class="code" href="classfasttext_1_1Vector.html">Vector</a> <a class="code" href="classfasttext_1_1Model.html#a79bd4bcbd2e6f10c5483249dfea74e97">grad_</a>;</div><div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a0b7f9ccdcdb6e44c0515b46af829bc19">   48</a></span>&#160;    int32_t <a class="code" href="classfasttext_1_1Model.html#a0b7f9ccdcdb6e44c0515b46af829bc19">hsz_</a>;</div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a39799429dd196a7ec7e4bdee63087751">   49</a></span>&#160;    int32_t <a class="code" href="classfasttext_1_1Model.html#a39799429dd196a7ec7e4bdee63087751">osz_</a>;</div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a3cc48ada470c99ef69840cf79967616e">   50</a></span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a> <a class="code" href="classfasttext_1_1Model.html#a3cc48ada470c99ef69840cf79967616e">loss_</a>;</div><div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#aeec9f08e7775bfcab322960fc80d7621">   51</a></span>&#160;    int64_t <a class="code" href="classfasttext_1_1Model.html#aeec9f08e7775bfcab322960fc80d7621">nexamples_</a>;</div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a8df9424c08479931b6351844be3bd090">   52</a></span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>* <a class="code" href="classfasttext_1_1Model.html#a8df9424c08479931b6351844be3bd090">t_sigmoid</a>;</div><div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a790013d8e68ed70db7074c9d3e262170">   53</a></span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>* <a class="code" href="classfasttext_1_1Model.html#a790013d8e68ed70db7074c9d3e262170">t_log</a>;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="comment">// used for negative sampling:</span></div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a082187d7f01c243f296084878ea0e0f1">   55</a></span>&#160;    std::vector&lt;int32_t&gt; <a class="code" href="classfasttext_1_1Model.html#a082187d7f01c243f296084878ea0e0f1">negatives</a>;</div><div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#afaf1104f9e1c382c3eb30ca41311e84f">   56</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="classfasttext_1_1Model.html#afaf1104f9e1c382c3eb30ca41311e84f">negpos</a>;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="comment">// used for hierarchical softmax:</span></div><div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a0ff68cfe9333feff1f8914f3787b1b5f">   58</a></span>&#160;    std::vector&lt; std::vector&lt;int32_t&gt; &gt; <a class="code" href="classfasttext_1_1Model.html#a0ff68cfe9333feff1f8914f3787b1b5f">paths</a>;</div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#ab6675d265df22787dfa9835196300d3b">   59</a></span>&#160;    std::vector&lt; std::vector&lt;bool&gt; &gt; <a class="code" href="classfasttext_1_1Model.html#ab6675d265df22787dfa9835196300d3b">codes</a>;</div><div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a53a03f49121369e4100ceb6ab06f178a">   60</a></span>&#160;    std::vector&lt;Node&gt; <a class="code" href="classfasttext_1_1Model.html#a53a03f49121369e4100ceb6ab06f178a">tree</a>;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> comparePairs(<span class="keyword">const</span> std::pair&lt;real, int32_t&gt;&amp;,</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;                             <span class="keyword">const</span> std::pair&lt;real, int32_t&gt;&amp;);</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    int32_t getNegative(int32_t target);</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="keywordtype">void</span> initSigmoid();</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="keywordtype">void</span> initLog();</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#ab8e5d608cd0338d1dc2e2b2eeaed751c">   69</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> int32_t NEGATIVE_TABLE_SIZE = 10000000;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;  <span class="keyword">public</span>:</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <a class="code" href="classfasttext_1_1Model.html">Model</a>(std::shared_ptr&lt;Matrix&gt;, std::shared_ptr&lt;Matrix&gt;,</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;          std::shared_ptr&lt;Args&gt;, int32_t);</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    ~<a class="code" href="classfasttext_1_1Model.html">Model</a>();</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a> binaryLogistic(int32_t, <span class="keywordtype">bool</span>, <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>);</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a> negativeSampling(int32_t, <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>);</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a> hierarchicalSoftmax(int32_t, <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>);</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a> <a class="code" href="namespacefasttext.html#a1ba04862fd670674501ccacc936e1952ace2f1fbd249d24aabc07ac4488ab5b8c">softmax</a>(int32_t, <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>);</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="main_8cc.html#a4479606e315746032f4ecde4b62ebc26">predict</a>(<span class="keyword">const</span> std::vector&lt;int32_t&gt;&amp;, int32_t,</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;                 std::vector&lt;std::pair&lt;real, int32_t&gt;&gt;&amp;,</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;                 <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;, <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;) <span class="keyword">const</span>;</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="main_8cc.html#a4479606e315746032f4ecde4b62ebc26">predict</a>(<span class="keyword">const</span> std::vector&lt;int32_t&gt;&amp;, int32_t,</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;                 std::vector&lt;std::pair&lt;real, int32_t&gt;&gt;&amp;);</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <span class="keywordtype">void</span> dfs(int32_t, int32_t, <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>,</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;             std::vector&lt;std::pair&lt;real, int32_t&gt;&gt;&amp;,</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;             <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;) <span class="keyword">const</span>;</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keywordtype">void</span> findKBest(int32_t, std::vector&lt;std::pair&lt;real, int32_t&gt;&gt;&amp;,</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;                   <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;, <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;) <span class="keyword">const</span>;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="keywordtype">void</span> update(<span class="keyword">const</span> std::vector&lt;int32_t&gt;&amp;, int32_t, <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>);</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="keywordtype">void</span> computeHidden(<span class="keyword">const</span> std::vector&lt;int32_t&gt;&amp;, <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;) <span class="keyword">const</span>;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="keywordtype">void</span> computeOutputSoftmax(<a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;, <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;) <span class="keyword">const</span>;</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    <span class="keywordtype">void</span> computeOutputSoftmax();</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    <span class="keywordtype">void</span> setTargetCounts(<span class="keyword">const</span> std::vector&lt;int64_t&gt;&amp;);</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="keywordtype">void</span> initTableNegatives(<span class="keyword">const</span> std::vector&lt;int64_t&gt;&amp;);</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    <span class="keywordtype">void</span> buildTree(<span class="keyword">const</span> std::vector&lt;int64_t&gt;&amp;);</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a> getLoss() <span class="keyword">const</span>;</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a> sigmoid(<a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>) <span class="keyword">const</span>;</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a> log(<a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>) <span class="keyword">const</span>;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;</div><div class="line"><a name="l00103"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a7e27d2fd2800dcee09ea8101fea49676">  103</a></span>&#160;    std::minstd_rand <a class="code" href="classfasttext_1_1Model.html#a7e27d2fd2800dcee09ea8101fea49676">rng</a>;</div><div class="line"><a name="l00104"></a><span class="lineno"><a class="line" href="classfasttext_1_1Model.html#a0d3b51a1c171314b879aae52c3717a43">  104</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classfasttext_1_1Model.html#a0d3b51a1c171314b879aae52c3717a43">quant_</a>;</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="keywordtype">void</span> setQuantizePointer(std::shared_ptr&lt;QMatrix&gt;, std::shared_ptr&lt;QMatrix&gt;, <span class="keywordtype">bool</span>);</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;};</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;}</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="classfasttext_1_1Model_html_a8df9424c08479931b6351844be3bd090"><div class="ttname"><a href="classfasttext_1_1Model.html#a8df9424c08479931b6351844be3bd090">fasttext::Model::t_sigmoid</a></div><div class="ttdeci">real * t_sigmoid</div><div class="ttdef"><b>Definition:</b> model.h:52</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a3cc48ada470c99ef69840cf79967616e"><div class="ttname"><a href="classfasttext_1_1Model.html#a3cc48ada470c99ef69840cf79967616e">fasttext::Model::loss_</a></div><div class="ttdeci">real loss_</div><div class="ttdef"><b>Definition:</b> model.h:50</div></div>
<div class="ttc" id="structfasttext_1_1Node_html_a57d838e16a5dbb34aa0548a20843cf09"><div class="ttname"><a href="structfasttext_1_1Node.html#a57d838e16a5dbb34aa0548a20843cf09">fasttext::Node::parent</a></div><div class="ttdeci">int32_t parent</div><div class="ttdef"><b>Definition:</b> model.h:31</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a4ee087454e830b18c22a59ae9bb6fcf1"><div class="ttname"><a href="classfasttext_1_1Model.html#a4ee087454e830b18c22a59ae9bb6fcf1">fasttext::Model::qwo_</a></div><div class="ttdeci">std::shared_ptr&lt; QMatrix &gt; qwo_</div><div class="ttdef"><b>Definition:</b> model.h:43</div></div>
<div class="ttc" id="structfasttext_1_1Node_html"><div class="ttname"><a href="structfasttext_1_1Node.html">fasttext::Node</a></div><div class="ttdef"><b>Definition:</b> model.h:30</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a7e27d2fd2800dcee09ea8101fea49676"><div class="ttname"><a href="classfasttext_1_1Model.html#a7e27d2fd2800dcee09ea8101fea49676">fasttext::Model::rng</a></div><div class="ttdeci">std::minstd_rand rng</div><div class="ttdef"><b>Definition:</b> model.h:103</div></div>
<div class="ttc" id="structfasttext_1_1Node_html_a8a02d78386d6837a20858269bf9c6366"><div class="ttname"><a href="structfasttext_1_1Node.html#a8a02d78386d6837a20858269bf9c6366">fasttext::Node::right</a></div><div class="ttdeci">int32_t right</div><div class="ttdef"><b>Definition:</b> model.h:33</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a53a03f49121369e4100ceb6ab06f178a"><div class="ttname"><a href="classfasttext_1_1Model.html#a53a03f49121369e4100ceb6ab06f178a">fasttext::Model::tree</a></div><div class="ttdeci">std::vector&lt; Node &gt; tree</div><div class="ttdef"><b>Definition:</b> model.h:60</div></div>
<div class="ttc" id="namespacefasttext_html"><div class="ttname"><a href="namespacefasttext.html">fasttext</a></div><div class="ttdef"><b>Definition:</b> args.cc:17</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html"><div class="ttname"><a href="classfasttext_1_1Vector.html">fasttext::Vector</a></div><div class="ttdef"><b>Definition:</b> vector.h:23</div></div>
<div class="ttc" id="structfasttext_1_1Node_html_a76430b0ffbb3b8f217435b11e4f51118"><div class="ttname"><a href="structfasttext_1_1Node.html#a76430b0ffbb3b8f217435b11e4f51118">fasttext::Node::count</a></div><div class="ttdeci">int64_t count</div><div class="ttdef"><b>Definition:</b> model.h:34</div></div>
<div class="ttc" id="namespacefasttext_html_a1ba04862fd670674501ccacc936e1952ace2f1fbd249d24aabc07ac4488ab5b8c"><div class="ttname"><a href="namespacefasttext.html#a1ba04862fd670674501ccacc936e1952ace2f1fbd249d24aabc07ac4488ab5b8c">fasttext::loss_name::softmax</a></div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a790013d8e68ed70db7074c9d3e262170"><div class="ttname"><a href="classfasttext_1_1Model.html#a790013d8e68ed70db7074c9d3e262170">fasttext::Model::t_log</a></div><div class="ttdeci">real * t_log</div><div class="ttdef"><b>Definition:</b> model.h:53</div></div>
<div class="ttc" id="main_8cc_html_a4479606e315746032f4ecde4b62ebc26"><div class="ttname"><a href="main_8cc.html#a4479606e315746032f4ecde4b62ebc26">predict</a></div><div class="ttdeci">void predict(int argc, char **argv)</div><div class="ttdef"><b>Definition:</b> main.cc:138</div></div>
<div class="ttc" id="classfasttext_1_1Model_html"><div class="ttname"><a href="classfasttext_1_1Model.html">fasttext::Model</a></div><div class="ttdef"><b>Definition:</b> model.h:38</div></div>
<div class="ttc" id="real_8h_html"><div class="ttname"><a href="real_8h.html">real.h</a></div></div>
<div class="ttc" id="classfasttext_1_1Model_html_ab6675d265df22787dfa9835196300d3b"><div class="ttname"><a href="classfasttext_1_1Model.html#ab6675d265df22787dfa9835196300d3b">fasttext::Model::codes</a></div><div class="ttdeci">std::vector&lt; std::vector&lt; bool &gt; &gt; codes</div><div class="ttdef"><b>Definition:</b> model.h:59</div></div>
<div class="ttc" id="matrix_8h_html"><div class="ttname"><a href="matrix_8h.html">matrix.h</a></div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a0b7f9ccdcdb6e44c0515b46af829bc19"><div class="ttname"><a href="classfasttext_1_1Model.html#a0b7f9ccdcdb6e44c0515b46af829bc19">fasttext::Model::hsz_</a></div><div class="ttdeci">int32_t hsz_</div><div class="ttdef"><b>Definition:</b> model.h:48</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a0d3b51a1c171314b879aae52c3717a43"><div class="ttname"><a href="classfasttext_1_1Model.html#a0d3b51a1c171314b879aae52c3717a43">fasttext::Model::quant_</a></div><div class="ttdeci">bool quant_</div><div class="ttdef"><b>Definition:</b> model.h:104</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a79bd4bcbd2e6f10c5483249dfea74e97"><div class="ttname"><a href="classfasttext_1_1Model.html#a79bd4bcbd2e6f10c5483249dfea74e97">fasttext::Model::grad_</a></div><div class="ttdeci">Vector grad_</div><div class="ttdef"><b>Definition:</b> model.h:47</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_ac9524ea5200abefdd2d83e29ffaa9693"><div class="ttname"><a href="classfasttext_1_1Model.html#ac9524ea5200abefdd2d83e29ffaa9693">fasttext::Model::qwi_</a></div><div class="ttdeci">std::shared_ptr&lt; QMatrix &gt; qwi_</div><div class="ttdef"><b>Definition:</b> model.h:42</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_afaf1104f9e1c382c3eb30ca41311e84f"><div class="ttname"><a href="classfasttext_1_1Model.html#afaf1104f9e1c382c3eb30ca41311e84f">fasttext::Model::negpos</a></div><div class="ttdeci">size_t negpos</div><div class="ttdef"><b>Definition:</b> model.h:56</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a0ff68cfe9333feff1f8914f3787b1b5f"><div class="ttname"><a href="classfasttext_1_1Model.html#a0ff68cfe9333feff1f8914f3787b1b5f">fasttext::Model::paths</a></div><div class="ttdeci">std::vector&lt; std::vector&lt; int32_t &gt; &gt; paths</div><div class="ttdef"><b>Definition:</b> model.h:58</div></div>
<div class="ttc" id="vector_8h_html"><div class="ttname"><a href="vector_8h.html">vector.h</a></div></div>
<div class="ttc" id="structfasttext_1_1Node_html_a567bed8e85aa54f73371420f1b42dcda"><div class="ttname"><a href="structfasttext_1_1Node.html#a567bed8e85aa54f73371420f1b42dcda">fasttext::Node::binary</a></div><div class="ttdeci">bool binary</div><div class="ttdef"><b>Definition:</b> model.h:35</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_ad6b3771605106e55bb132be316ec34b9"><div class="ttname"><a href="classfasttext_1_1Model.html#ad6b3771605106e55bb132be316ec34b9">fasttext::Model::wo_</a></div><div class="ttdeci">std::shared_ptr&lt; Matrix &gt; wo_</div><div class="ttdef"><b>Definition:</b> model.h:41</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_ae7c72e4f6b9fda134708d08efb0170e2"><div class="ttname"><a href="classfasttext_1_1Model.html#ae7c72e4f6b9fda134708d08efb0170e2">fasttext::Model::wi_</a></div><div class="ttdeci">std::shared_ptr&lt; Matrix &gt; wi_</div><div class="ttdef"><b>Definition:</b> model.h:40</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a845160e4cdb0e8c17b74f269563dc71c"><div class="ttname"><a href="classfasttext_1_1Model.html#a845160e4cdb0e8c17b74f269563dc71c">fasttext::Model::output_</a></div><div class="ttdeci">Vector output_</div><div class="ttdef"><b>Definition:</b> model.h:46</div></div>
<div class="ttc" id="args_8h_html"><div class="ttname"><a href="args_8h.html">args.h</a></div></div>
<div class="ttc" id="namespacefasttext_html_a7afdad102f318271c14154b8e65e5ea3"><div class="ttname"><a href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">fasttext::real</a></div><div class="ttdeci">float real</div><div class="ttdef"><b>Definition:</b> real.h:15</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_aeec9f08e7775bfcab322960fc80d7621"><div class="ttname"><a href="classfasttext_1_1Model.html#aeec9f08e7775bfcab322960fc80d7621">fasttext::Model::nexamples_</a></div><div class="ttdeci">int64_t nexamples_</div><div class="ttdef"><b>Definition:</b> model.h:51</div></div>
<div class="ttc" id="structfasttext_1_1Node_html_a44f47a277a7fc982be30569befc7d8c1"><div class="ttname"><a href="structfasttext_1_1Node.html#a44f47a277a7fc982be30569befc7d8c1">fasttext::Node::left</a></div><div class="ttdeci">int32_t left</div><div class="ttdef"><b>Definition:</b> model.h:32</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a76314e94e2582e9e2160bcfd9c75ba99"><div class="ttname"><a href="classfasttext_1_1Model.html#a76314e94e2582e9e2160bcfd9c75ba99">fasttext::Model::args_</a></div><div class="ttdeci">std::shared_ptr&lt; Args &gt; args_</div><div class="ttdef"><b>Definition:</b> model.h:44</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a082187d7f01c243f296084878ea0e0f1"><div class="ttname"><a href="classfasttext_1_1Model.html#a082187d7f01c243f296084878ea0e0f1">fasttext::Model::negatives</a></div><div class="ttdeci">std::vector&lt; int32_t &gt; negatives</div><div class="ttdef"><b>Definition:</b> model.h:55</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a31e9eee86f238bd2962569be67444e79"><div class="ttname"><a href="classfasttext_1_1Model.html#a31e9eee86f238bd2962569be67444e79">fasttext::Model::hidden_</a></div><div class="ttdeci">Vector hidden_</div><div class="ttdef"><b>Definition:</b> model.h:45</div></div>
<div class="ttc" id="classfasttext_1_1Model_html_a39799429dd196a7ec7e4bdee63087751"><div class="ttname"><a href="classfasttext_1_1Model.html#a39799429dd196a7ec7e4bdee63087751">fasttext::Model::osz_</a></div><div class="ttdeci">int32_t osz_</div><div class="ttdef"><b>Definition:</b> model.h:49</div></div>
<div class="ttc" id="qmatrix_8h_html"><div class="ttname"><a href="qmatrix_8h.html">qmatrix.h</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="model_8h.html">model.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
